Repository navigation
fix(formatter): offload media conversion from event loop - #2725
Open
wangtaotaotao95 wants to merge 7 commits into
Open
wangtaotaotao95 wants to merge 7 commits into
wangtaotaotao95 wants to merge 7 commits into
Conversation
4 of 5 tasks
wangtaotaotao95
force-pushed
the
fix/formatter-remote-media-async
branch
from
September 25, 2026 05:59
93618ed to
202c165
Compare
Contributor
Author
|
Rebased onto current main (head 202c165) and reconciled the xAI helper extraction with the async local-file read path. Validation:
|
This was referenced Sep 28, 2026
Contributor
|
Thanks for the pull request. One thing worth sorting out before it is reviewed:
If you think it belongs here anyway, say so and a maintainer will take a look. |
Contributor
Author
|
Following up on the PR guard: @ZxlDragonDoctor explicitly released the claim on #2724 after checking this existing PR and confirmed that they have no competing PR for the issue: #2724 (comment) . The issue still appears assigned to them, so the guard is reading stale claim metadata. Could a maintainer clear the released claim and re-evaluate the guard for this PR? This change continues the existing fix; it does not compete with an active claim. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AgentScope Version
2.0.8 (main at
5ff52f87)Description
Fixes #2724.
AgentScope's formatter methods are async, but media conversion could perform synchronous downloads or local file reads on the event-loop thread. A slow image, audio, or PDF operation could therefore stall unrelated coroutines for up to the request timeout.
This PR offloads existing synchronous DataBlock conversion helpers through
asyncio.to_threadin the OpenAI Chat/Responses, Anthropic, Gemini, Moonshot, Ollama, and xAI formatters. It preserves the current helper APIs and output schemas while moving blocking downloads and file reads away from the event loop.Regression coverage includes:
Verification:
The patch and tests were prepared with AI assistance and manually reviewed and verified.
Checklist
Current-head validation (2026-10-01)
Merged main
72f3f6fainto this branch and resolved the Moonshot import conflict, retaining asynchronous media conversion and all current main behavior. Atadc464f8, all formatter suites passed: 150 tests and 4 subtests. All pre-commit hooks on the conflict-resolved Moonshot file passed, andgit diff --checkpassed.Claim coordination: the previous claimant explicitly released #2724 in favor of this PR: #2724 (comment) . The remaining assignment/guard metadata needs maintainer cleanup.